<?php
    include(dirname(dirname(__FILE__)).'/accesobd.php');
    
    $ci = $_POST["ci_cliente"];

    if ($ci){  
        $query = pg_query($conex,"SELECT cliente.cic FROM cliente WHERE $ci=cliente.cic");

        $cedula = pg_fetch_array($query);
        
        if(!$cedula){
            echo '<script type="text/javascript">', 'window.alert("Error: Usuario no registrado");',
                    'location.reload(true);', 'window.location.assign("../plantilla/agregarCliente.php");', '</script>';
        }else{
            echo '<script type="text/javascript">', 'window.alert("Usuario registrado");',
                    'location.reload(true);', '</script>';
        }
        
        pg_close($conex);
    }else{
        
    }
    
?>
